package directive;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import modele.dao.LoginDAO;
import modele.form.LoginForm;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class LoginAction extends GlobalAction {

	private LoginDAO loginDAO;
	
@Override
public String executeAction(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response)
		throws Exception {
	LoginForm loginform = (LoginForm) form;
	loginDAO = new LoginDAO(this.conn);
	
	return loginDAO.Validate(loginform.getUsername(), loginform.getPassword()) ? ACTION_SUCCESS : ACTION_FAIL;
}
}